package com.dys.controller;

import com.dys.common.ResponseResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 疾风
 * @ClassName: CorsController
 * @Description: 使用注解解决跨域
 * @CreateDate: 2024/12/17
 * @Version: v1.0.0
 */
@RestController
@RequestMapping(value = {"/cors"})
public class CorsController {

    @CrossOrigin(origins = "http://localhost:8094")
    @GetMapping("/my-endpoint")
    public ResponseResult<String> corsRequest(){
        return new ResponseResult<>(200,"响应成功","通过使用 @CrossOrigin 注解来解决跨域问题");
    }
}
